unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, TeeProcs, TeEngine, Chart, StdCtrls, Series, ComCtrls;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Button1: TButton;
    Label5: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Series1: TLineSeries;
    Label6: TLabel;
    ListView1: TListView;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var r,p,c,y:real;
    d,x:integer;
    lista:TListItem;
begin
d:=StrTointDef(Edit1.Text,0);
r:=StrToFloatDef(Edit2.Text,0);
p:= d * r ;
c:=(d*d)/(16*p);
Edit3.Text:=FloatToStr(p);
Edit4.Text:=FloatToStr(c);
Series1.Clear;
ListView1.Clear;

//curva da parabola
For  x:=((d div 2)* -1) to d div 2 do
  begin
  y:= ((4*c*x*x)/(d*d));
  Series1.AddXY(x,y);
  end;

//cordenadas
For  x:=0 to d div 2 do
  begin
  y:= ((4*c*x*x)/(d*d));
  lista := ListView1.Items.Add;
  Lista.Caption :=IntToStr(x);
  Lista.SubItems.Add(FloatToStrF(y,ffFixed,5,2));

  end;

//prenche a parabola
For  x:=((d div 2)* -1) to d div 2 do
  begin
  Series1.AddXY(x,c)
  end;

//ponto focal  
Series1.AddXY(-1,p);
Series1.AddXY(0,p);
Series1.AddXY(1,p);

end;

end.




